package rdobson.management.projectclock;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;

public class DatabaseHelper extends SQLiteOpenHelper {

	private static final String DATABASE_NAME="ProjectClock";
	
	public DatabaseHelper(Context context) {
		super(context, DATABASE_NAME, null, 1);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		createTables(db);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		android.util.Log.w("Locations","Upgrading database, which will destroy all old data");
		dropTables(db);
		onCreate(db);
	}
	
	public static void dropTable(SQLiteDatabase db, String table){
		db.execSQL("DROP TABLE IF EXISTS " + table);
	}
	
	public void dropTables(SQLiteDatabase db){
		db.execSQL("DROP TABLE IF EXISTS time_markers");
	}
	
	public void createTables(SQLiteDatabase db){
		db.execSQL("CREATE TABLE locations (_id INTEGER PRIMARY KEY AUTOINCREMENT, project_code TEXT, date_time TEXT);"); 
		//populateTables(db);
	}
	
	public void populateTables(SQLiteDatabase db){

		//Program_Variables
		//ContentValues c = new ContentValues();
		//c.put(TITLE, "photoNum");
		//c.put(VALUE, 1);
		//db.insert("program_values", TITLE, c);
		
		//c.put(TITLE, "iZoomLevel");
		//c.put(VALUE, 15);
		//db.insert("program_values", TITLE, c);
	}
	

}
